package com.jzo2o.customer.controller.agency;

import com.jzo2o.common.constants.UserType;
import com.jzo2o.customer.model.dto.request.BankAccountUpsertReqDTO;
import com.jzo2o.customer.model.dto.response.BankAccountResDTO;
import com.jzo2o.customer.service.IBankAccService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/*
 *   Description BankAccountController
 *   @author zhangyan
 *   @time   2024/12/2
 */
@RestController("agencyBankAccountController")
@RequestMapping("/agency/bank-account")
@Api(tags = "机构端 - 银行账户相关接口")
public class BankAccountController {
    @Autowired
    private IBankAccService bankAccService;
    @PostMapping
    @ApiOperation("添加或更新账户")
    public void add(@RequestBody BankAccountUpsertReqDTO dto) {
        //表示为机构端
        dto.setType(UserType.INSTITUTION);
        bankAccService.add(dto);
    }
    @GetMapping("/currentUserBankAccount")
    @ApiOperation("获取当前用户的银行卡信息")
    public BankAccountResDTO currentUSerBankAccount(){
      return   bankAccService.currentUserBankAccount();
    }

}
